package com.xh.demo.common.enums;

import com.xh.demo.common.message.ICommonMessage;

/**
 * @Name ErrorEnum
 * @Description 错误枚举
 * @Author wen
 * @Date 2019-08-01
 */
public enum ErrorEnum implements ICommonMessage{

    //基本类型
    SUCCESS(0, "操作成功"),
    FAIL(-1, "操作失败"),

    //100开头定义请求异常类型
    UNKNOWN_ERROR(10001, "未知错误"),
    REQUEST_PARAMETERS_ERROR(10002, "请求参数错误"),
    DATE_PARAMETER_ERROR(10003, "日期字符串格式错误"),
    USER_TOKEN_IS_NOT_EXIST(10004, "用户tonken不存在"),


    //300开头为文件相关错误
    FILE_WRITE_ERROR(30001, "文件上传失败"),
    FILE_IS_NOT_PICTURE(30002, "不支持的文件类型"),
    MAX_UPLOAD_SIZE_EXCEEDED(30003, "文件大小不能超过3MB"),
    FILE_IS_NOT_EXIST(30004, "图片文件不能为空"),


    ;

    private int code;

    private String msg;

    ErrorEnum(int code, String msg){
        this.code = code;
        this.msg = msg;
    }

    @Override
    public int getCode() {
        return code;
    }

    @Override
    public String getMsg() {
        return msg;
    }

    @Override
    public void setMsg(String msg) {
        this.msg = msg;
    }

}
